'use strict';
const {TITLE_ESCROW_ABI:CABI ,TITLE_ESCROW_BIN:CBIN } = require('./compiledContracts/titleEscrow');
const logger = require("../utils/logger");
const {deploy,send} = require("./compiledContracts")

const deployTitleEscrow = async (tokenRegistry, beneficiary, holder, titleEscrowCreator) => {
    let parameters = [tokenRegistry, beneficiary, holder, titleEscrowCreator]
    return deploy(parameters,CABI,CBIN)
};

const transferToNewEscrow = async (titleEscrow, newBeneficiary, newHolder) => {
    return send("transferToNewEscrow(address,address)", [newBeneficiary, newHolder],titleEscrow,CABI);
}

const beneficiary = async (titleEscrow) => {
    return send("beneficiary()", [],titleEscrow,CABI, true);
}

const holder = async (titleEscrow) => {
    return send("holder()",[],titleEscrow,CABI, true);
}

module.exports = {
    deployTitleEscrow,
    transferToNewEscrow,
    beneficiary,
    holder
};
